# # 1，打印小猫爱吃鱼，小猫要喝水
# class cat():
#     def fish(self):
#         print('小猫爱吃鱼')
#     def drink(self):
#         print('小猫爱喝水')
# if __name__ == '__main__':
#     xiaomao = cat()
#     xiaomao.fish()
#     xiaomao.drink()


# # 2,小明爱跑步，爱吃东西
# class min():
#     def __init__(self,name,wight):
#         self.name = name
#         self.wight = int(wight)
#     def run(self):
#         self.wight = self.wight-0.5
#     def eat(self):
#         self.wight = self.wight+1
#     def __str__(self):
#         return f'{self.name}的体重是{self.wight}'
# if __name__ == '__main__':
#     ming = min('小明','75')
#     print(ming)
#     ming.run()
#     ming.eat()
#     print(ming)
#     print(ming.wight)
#     hong =min('小红',45.0)
#     print(hong)

# # 家具
# class jiajulei():
#     def __init__(self,name,mian):
#         self.name = name
#         self.mianji = mian
#     def __str__(self):
#         return f'{self.name}家具占地{self.mianji}'
#
# class house():
#     def __init__(self,huxing,mianji):
#         self.huxing = huxing
#         self.zongmianji = mianji
#         self.shengyu = mianji
#         self.jiaju = []
#     def addjiaju(self,jiaju):
#         self.shengyu = self.zongmianji - jiaju.mianji
#         self.jiaju.append(jiaju.name)
#
#     def __str__(self):
#         return f'房子的户型是{self.huxing},总面积是{self.zongmianji}平米,剩余面积{self.shengyu}平米,一共放了一些{self.jiaju}'
# if __name__ == '__main__':
#     chuang= jiajulei('床',4)
#     yigui = jiajulei('衣柜',2)
#     canzhuo = jiajulei('餐桌',1.5)
#     fang = house('别墅',20)
#     fang.addjiaju(chuang)
#     fang.addjiaju(yigui)
#     fang.addjiaju(canzhuo)
#     print(fang)




# 士兵开枪
class qiang():
    def __init__(self,name,zidan):
        self.name = name
        self.zidan = zidan
    def huan(self):
        if self.zidan>0:
            print('打完再来吧')
        else:
            while self.zidan <9:
                self.zidan+=1
            print('装填完成')
    def dada(self):
        if self.zidan>0:
            for i in range(self.zidan):
                print('哒',end='')
            self.zidan = 0
            print()
        else:
             print('去加点子弹吧')
    def __str__(self):
        return f'{self.name}'

class ren():
    def __init__(self,name,qiang):
        self.name = name
        self.qiang = qiang
    def kaihuo(self):
        self.qiang.dada()
    def __str__(self):
        return f'{self.name}一有个{self.qiang}的枪'
if __name__ == '__main__':
    AK47 = qiang('AK',3)
    AK47.dada()
    AK47.dada()
    AK47.huan()
    AK47.huan()
    shibing = ren('瑞恩',AK47)
    shibing.kaihuo()
    print(shibing)


